<?php
class proservice {
    var $result;
  var $result2;
  var $ws_client;
   
    function __construct() {
  require_once 'nusoap.php';

     }

     private function clientsd()
     {
    $ws_client = new nusoap_client('http://www.khonuthai.com/ktwservice/ktwservice.php?wsdl', true);        
  return $ws_client;
     }
     
    public function newserverurl($userpp,$passpp)
    {
                $capp= $this->clientsd();          
                $result = $capp->call('loginpt', array('username' => $userpp, 'password' => $passpp)); 
  //$result1 = $ws_client->call('seletecontents', array('appuser' => $result, 'username' => $_GET["username"] . '@' . $result, 'co_id' => $_GET["co_id"]));
//	echo $result1;
  return $result;
  }
    
  public function showdata($tourid)
  {
      
     $capps = $this->clientsd();
      // return 'sawatdee'.$tourid; 
      //$result;
      $result1 = $capps->call('seletecontents', array('appuser' => 'uthaicafe', 'username' => 'kpts@uthaicafe', 'co_id' => $tourid));
//	echo $result1;
//$result3 = $ws_client->call('seletecontentalls', array('appuser' => $result, 'username' => 'kpts@uthaicafe', 'queryvalue' => $tourid));
return $result1;
  }
  
public function selectalls($nowid)
{
$capps = $this->clientsd();
$result = $capps->call('loginpt', array('username' => 'uthaicafe', 'password' => '512432')); 
$result3 = $capps->call('seletecontentalls', array('appuser' => $result, 'username' => 'kpts@uthaicafe' , 'queryvalue' => $nowid));
    $arrss = explode("@@", $result3);
    $arrspt = explode("$", $arrss["0"]);
    $resultc = count($arrspt);
//	echo $resultc;
$dataarr = array();
$countpt = count($arrss);
for ($k = 1; $k < $countpt; $k++) {
    for ($i = 0; $i < $resultc; $i++) {
        $dataptt = explode("$", $arrss[$k]);
        $countdppt = count($dataptt);

//echo "<br>".$dataptt[$e];
        $dataarr["$k"][$arrspt[$i]] = $dataptt[$i];
   
        }
}
return $dataarr;

//เรียกใช้เซอร์วิสที่ได้สร้างขึ้นมา (goodbye function) 
//$result = $client->call('goodbye',array('name'=>'Mr.Pongsakorn Poosankam')); 
//แสดงผล 
//echo $result ; 

//อย่างนี้อ่ะครับ
}
/*
//echo $result3;



*/

}
    


?> 